<template>
  <yt-page title="指挥调度">
    <yt-tabs v-model="page">
      <yt-tab-panel text="分级响应">
        <yt-group :group="false" :searchApi="searchApiFJXY">
          <yt-card slot-scope="item">
            <yt-cell label="响应级别" :value="item.level"></yt-cell>
            <yt-cell label="响应条件" :value="item.condition"></yt-cell>
            <yt-cell label="严重程度" :value="item.degree"></yt-cell>
            <yt-cell label="响应层级" :value="item.Hierarchy"></yt-cell>
          </yt-card>
        </yt-group>
      </yt-tab-panel>
      <yt-tab-panel text="组织架构">
        <yt-group :group="false" :searchApi="searchApiZZJG">
          <yt-card slot-scope="item">
            <yt-cell label="所属部门" :value="item.department"></yt-cell>
            <yt-cell label="姓名" :value="item.name"></yt-cell>
            <yt-cell label="职务" :value="item.post"></yt-cell>
            <yt-cell label="联系方式" labelWidth="200px" border="none">
              <yt-cell-call :tel="item.mobile || ''"></yt-cell-call>
            </yt-cell>
          </yt-card>
        </yt-group>
      </yt-tab-panel>
      <yt-tab-panel text="应急队伍">
        <yt-group :group="false" :searchApi="searchApiDW">
          <yt-card slot-scope="item" :title="item.ranks_category" :tag="false">
            <yt-cell label="单位负责人" labelWidth="200px" :value="item.company_person"></yt-cell>
            <yt-cell label="单位联系方式" labelWidth="200px">
              <yt-cell-call :tel="item.company_mobile || ''"></yt-cell-call>
            </yt-cell>
            <yt-cell label="部门负责人" labelWidth="200px" :value="item.department_people"></yt-cell>
            <yt-cell label="部门联系方式" labelWidth="200px" border="none">
              <yt-cell-call :tel="item.department_mobile || ''"></yt-cell-call>
            </yt-cell>
          </yt-card>
        </yt-group>
      </yt-tab-panel>
      <yt-tab-panel text="应急资源">
        <yt-group :group="false" :searchApi="searchApiZY">
          <yt-card slot-scope="item" :title="item.name" :tag="false">
            <yt-cell border="none" label="物资类别" :value="item.type"></yt-cell>
            <yt-cell border="none" label="数量" :value="item.number"></yt-cell>
            <yt-cell border="none" label="功能用途" :value="item.purpose"></yt-cell>
            <yt-cell border="none" label="权属单位" :value="item.company"></yt-cell>
            <yt-cell border="none" label="权属区域" :value="item.region"></yt-cell>
            <yt-cell border="none" label="权属政府" :value="item.government"></yt-cell>
            <yt-cell border="none" label="单位负责人" :value="item.company_person"></yt-cell>
            <yt-cell border="none" label="单位联系方式" labelWidth="150px">
              <yt-cell-call :tel="item.company_mobile || ''"></yt-cell-call>
            </yt-cell>
            <yt-cell border="none" label="部门负责人" :value="item.department_people"></yt-cell>
            <yt-cell border="none" label="部门联系方式" labelWidth="150px">
              <yt-cell-call :tel="item.department_mobile || ''"></yt-cell-call>
            </yt-cell>
          </yt-card>
        </yt-group>
      </yt-tab-panel>
      <yt-tab-panel text="应急专家">
        <yt-group :group="false" :searchApi="searchApiZJ">
          <yt-card slot-scope="item">
            <yt-cell label="姓名" :value="item.name"></yt-cell>
            <yt-cell label="单位" :value="item.company"></yt-cell>
            <yt-cell label="专业" :value="item.major"></yt-cell>
            <yt-cell label="联系方式">
              <yt-cell-call :tel="item.peopleLX || ''"></yt-cell-call>
            </yt-cell>
          </yt-card>
        </yt-group>
      </yt-tab-panel>
    </yt-tabs>
  </yt-page>
</template>

<script>
import { commonApi } from '@/common/api/commonApi.js'
import { ReplaceDictionary } from '@/common/utils/index.js'

export default {
  data() {
    return {
      page: 0,
      searchApiFJXY: async ({ skip, limit }) => {
        let items = await commonApi.search('yj_Classification', { skip, limit })
        return items
      },
      searchApiZZJG: async ({ skip, limit }) => {
        let items = await commonApi.search('yj_mail_list_zh', { skip, limit })
        return items
      },
      searchApiDW: async ({ skip, limit }) => {
        let results = await commonApi.search('yj_mail_list_dw', { skip, limit })
        let ranksCategoryDic = await commonApi.dictionary('ranks_category')
        return ReplaceDictionary(results, { ranks_category: ranksCategoryDic })
      },
      searchApiZY: async ({ skip, limit }) => {
        let results = await commonApi.search('yj_relief_materials', {
          skip,
          limit
        })
        let categoryDic = await commonApi.dictionary('material_category')
        return ReplaceDictionary(results, { type: categoryDic })
      },
      searchApiZJ: async ({ skip, limit }) => {
        let results = await commonApi.search('yj_mail_list_zj', { skip, limit })
        return results
      }
    }
  }
}
</script>

<style scoped lang='stylus'>
>>> .yt-card-body
  padding 0
</style>
